<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<?php

use yii\helpers\Html;

?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
    <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"
            type="text/javascript"></script>
    <?php $this->head() ?>
    <link rel="canonical" href="<?= $base_url ?>/assets/public/css/AdminLTE.min.css"/>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<?php $this->beginBody() ?>
<div style="padding:10px">
    <div class="wrapper">
        <!-- 	查询开始与结束的日期 -->
        <div class="form-group">


            <?php $form = \yii\widgets\ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data', 'id' => 'form_0']]); ?>
            <?php
            $file = '';
            if (count($fileids)>0) {
                foreach ($fileids as $kk => $vv) {
                    $filesModel = \app\models\AsrFiles::findOne($vv['files_id']);
                    $filesize = round($filesModel->filesize / 1024, 1);
                    $file .= "<li><div  style='vertical-align: middle;background-color:#eeeeee33'>".
                        "<audio controls='controls' style='height:48px;' >".
                        "<source src='".$base_url.$filesModel->filepath."' type='audio/wav' />".
                        "<source src='".$base_url.$filesModel->filepath."' type='audio/ogg' />".
                        "<embed  src='".$base_url.$filesModel->filepath."' />".
                        "</audio>".
                        "         <input  name='AsrFiles[name][" . $vv['files_id'] . "][]' value='" . $filesModel->name . "     $filesize k'  style='border:0px;margin:0px 20px;'/>".
                        "<span class='pull-right badge bg-red' data-id='" . $vv['files_id'] . "' id='delete_file_0" . "_" . "$filesModel->name' style='border:0px;margin:10px 4px;'>删除</span></div></li>";
                }
            }
            $file = "\"" . $file . "\"";
            ?>
            <!--            ////////////////////////////////////////start//////////////////////////////////////////////////-->

            <input name="audio_id" hidden="hidden" value="<?= $audio_id ?>">
            <input name="delete_file" id="delete_file" hidden="hidden" value="">

            <div class="form-group  required">
                <label class="control-label" for="asraudio-name">当没有检测到关键字-语音文件上传</label>
                <?= $form->field(new \app\models\AsrFiles(), 'name[0][]')->widget(\kartik\file\FileInput::classname(), ['options' => ['accept' => 'pcm/wav', 'id' => 'select_files_0', 'multiple' => true], 'pluginOptions' => [// 最多上传的文件个数限制
                    'maxFileCount' => 10,]])->label("") ?>
                <div class="help-block"></div>
                <div class="box box-widget widget-user-2">
                    <ul class="nav nav-stacked" id="files">
                    </ul>
                </div>
            </div>
            </td>
            <script>
                $("#files").append(<?=$file?>);
                $("span[id^='delete_file_0_']").click(function () {
                    if (confirm("是否删除该文件？")){
                        $("#delete_file").val($(this).attr("data-id"));
                        $("#form_0").attr('action','delete-file2');
                        $("#save_0").submit();
                        $(this).parent().remove();
                    }
                });
                //绑定按钮的点击事件让上传按钮隐藏
                $("#select_files_0").bind('click',function () {
                    $("#form_0").attr("action","create-file2");
                })
            </script>
            <!-- !   保存-->
            <div class="form-group" hidden="hidden">
                <?= Html::submitButton('保存', ['class' => 'btn btn-info','id'=>'save_0']) ?>
            </div>
            <!-- !   当检测到关键字-语音文件上传-->
            <?php \yii\widgets\ActiveForm::end(); ?>
            <!--            /////////////////////////////////////////end/////////////////////////////////////////////////-->


        </div>
    </div>
</div>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>